<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>登录页面</title>
</head>
<body>
	
	<h1>用户登录</h1>
	<div>账号：<input type="text" id="uid" autocomplete="off" /></div> 
	<div>密码：<input type="password" id="pwd" autocomplete="off" /></div>
	<div><input type="button" value="登录" id="btn" /></div>
	
	<script src="jquery-3.2.1.min.js"></script>
	<script>
		$("#btn").click(function(){
			var uid = $("#uid").val();
			var pwd = $("#pwd").val();
			$.ajax({
				url: "http://127.0.0.1/PHPStudy/RBAC/login.php",
				data: {uid: uid, pwd: pwd},  //将用户和密码传到处理页面
		    type: "POST",
		    dataType: "text",
		    success: function(res){
		    	if(res.trim() == "OK"){
		    　　　　window.location.href = "http://127.0.0.1/PHPStudy/RBAC/main.html";
		    　　}
		    　　else{
		    　　　　alert("用户名密码输入错误");  //否则就提示错误
		    　　}
		    }
			});
		});
	</script>
</body>
</html>